package com.gali.juc;

/**
 * @Auther: gali
 * @Date: 2022-08-26 16:20
 * @Description:
 */
public class LockClearUpDemo {
    static Object object = new Object();
    public void m1(){
//        synchronized (object){
//            System.out.println("======锁消除======");
//        }
        Object o = new Object();
        synchronized (o){
            System.out.println("======锁消除======"+"\t"+o.hashCode()+"\t"+object.hashCode());
        }
    }
    public static void main(String[] args) {
        LockClearUpDemo lockClearUpDemo = new LockClearUpDemo();
        for (int i = 0; i < 10; i++) {
            new Thread(()->{
                lockClearUpDemo.m1();
            },"a").start();
        }
    }
}
